package com.qq2008.game.mojie.controller;

import com.qq2008.game.mojie.utils.EmailUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;

@Slf4j
@RestController
public class EmailController {


    @PostMapping("email")
    public String email(@RequestParam("email") String email) {
        log.info("邮箱注册{}", email);
        String sendEmail = null;
        try {
            sendEmail = EmailUtil.sendEmail(email);
        } catch (MessagingException e) {
            log.error("邮箱注册失败，{}", e.getMessage());
        }
        return sendEmail;
    }


}
